package com.dd.ent.car.ui.detail;

import android.content.Context;
import android.view.View;

import com.dd.ent.car.common.bean.comment.Comment;
import com.dd.ent.car.ui.adapter.ViewHolder;
import com.dd.ent.car.ui.adapter.base.BaseListAdapter;


/**
 * Created by huanghaibin
 * on 16-5-23.
 */
public class CommentAdapter extends BaseListAdapter<Comment> {
    private String systemTime;
    private DetailCommentView.OnCommentItemListener onCommentItemListener;
    public CommentAdapter(Callback callback,DetailCommentView.OnCommentItemListener onCommentItemListener) {
        super(callback);
        this.onCommentItemListener = onCommentItemListener;
    }

    @Override
    protected void convert(ViewHolder vh, Comment item, int position) {
    }

    @Override
    protected void refreshData(ViewHolder vh, View view, Comment item, int position) {
        if (view instanceof DetailCommentView){
            ((DetailCommentView)view).refresh(position,item);
        }
    }

    @Override
    protected int getLayoutId(int position, Comment item) {
        return -1;
    }

    @Override
    protected View bindView(Context context, int position, Comment item) {
        DetailCommentView detailCommentView = new DetailCommentView(context);
        detailCommentView.setOnCommentItemListener(onCommentItemListener);
        return detailCommentView;
    }

    public void setSystemTime(String systemTime) {
        this.systemTime = systemTime;
    }

}
